{extend name="public::base" /}

{block name="content"}
<div class="col-md-8">
    <div class="page-header">
        <h2>用户注册</h2>
    </div>
    <form class="form-horizontal" id="login">
        <div class="form-group">
            <label for="inputEmail1" class="col-sm-2 control-label">姓名：</label>
            <div class="col-sm-10">
                <input type="text" name="name" class="form-control" id="inputEmail1" placeholder="name">
            </div>
        </div>
        <div class="form-group">
            <label for="inputEmail2" class="col-sm-2 control-label">邮箱：</label>
            <div class="col-sm-10">
                <input type="text" name="email" class="form-control" id="inputEmail2" placeholder="Email">
            </div>
        </div>
        <div class="form-group">
            <label for="inputEmail3" class="col-sm-2 control-label">手机：</label>
            <div class="col-sm-10">
                <input type="text" name="mobile" class="form-control" id="inputEmail3" placeholder="mobile">
            </div>
        </div>
        <div class="form-group">
            <label for="inputPassword3" class="col-sm-2 control-label">密码：</label>
            <div class="col-sm-10">
                <input type="password" name="password" class="form-control" id="inputPassword3" placeholder="Password">
            </div>
        </div>
        <div class="form-group">
            <label for="inputPassword4" class="col-sm-2 control-label">确认密码：</label>
            <div class="col-sm-10">
                <input type="password" name="password_confirm" class="form-control" id="inputPassword4" placeholder="Password Confirm">
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="button" class="btn btn-primary">注册</button>
            </div>
        </div>
    </form>
</div>
{/block}

{block name="footer"}
<script type="text/javascript">
$(function () {
    $('.btn-primary').on('click',function () {
        $.ajax({
            type:'post',
            url:"{:url('insert')}",
//            url:"{:url('index/index/insert')}",
            dataType:'json',
            data:$('#login').serialize(),
            success:function (res) {
                alert(res.message);
                if(res.status == '1'){
                    location.href = "{:url('index/index/index')}";
                }
            }
        });
    });
});
</script>
{/block}